package com.gitee.wsl.lang.character


import com.gitee.wsl.test.Preconditions.checkArgument


val Char.Companion.ascii get() = Ascii

/**
 * Static methods pertaining to ASCII characters (those in the range of values `0x00` through
 * `0x7F`), and to strings containing such characters.
 *
 *
 * ASCII utilities also exist in other classes of this package:
 *
 *
 *
 *  * [Charsets.US_ASCII] specifies the `Charset` of ASCII characters.
 *  * [CharMatcher.ascii] matches ASCII characters and provides text processing methods
 * which operate only on the ASCII characters of a string.
 *
 *
 * @author Catherine Berry
 * @author Gregory Kick
 * @since 7.0
 */
object Ascii {
    /**
     * The minimum value of an ASCII character.
     *
     * @since 9.0 (was type `int` before 12.0)
     */
    const val MIN = 0.toChar()

    /**
     * The maximum value of an ASCII character.
     *
     * @since 9.0 (was type `int` before 12.0)
     */
    const val MAX = 127.toChar()

    /** A bit mask which selects the bit encoding ASCII character case.  */
    private const val CASE_MASK = 0x20.toChar()


    /* The ASCII control characters, per RFC 20. */
    /**
     * Null ('\0'): The all-zeros character which may serve to accomplish time fill and media fill.
     * Normally used as a C string terminator.
     *
     *
     * Although RFC 20 names this as "Null", note that it is distinct from the C/C++ "NULL"
     * pointer.
     *
     * @since 8.0
     */
    //const val NUL: Byte = 0

    /**
     * Start of Heading: A communication control character used at the beginning of a sequence of
     * characters which constitute a machine-sensible address or routing information. Such a sequence
     * is referred to as the "heading." An STX character has the effect of terminating a heading.
     *
     * @since 8.0
     */
    //const val SOH: Byte = 1

    /**
     * Start of Text: A communication control character which precedes a sequence of characters that
     * is to be treated as an entity and entirely transmitted through to the ultimate destination.
     * Such a sequence is referred to as "text." STX may be used to terminate a sequence of characters
     * started by SOH.
     *
     * @since 8.0
     */
    //const val STX: Byte = 2

    /**
     * End of Text: A communication control character used to terminate a sequence of characters
     * started with STX and transmitted as an entity.
     *
     * @since 8.0
     */
    //const val ETX: Byte = 3

    /**
     * End of Transmission: A communication control character used to indicate the conclusion of a
     * transmission, which may have contained one or more texts and any associated headings.
     *
     * @since 8.0
     */
    //const val EOT: Byte = 4

    /**
     * Enquiry: A communication control character used in data communication systems as a request for
     * a response from a remote station. It may be used as a "Who Are You" (WRU) to obtain
     * identification, or may be used to obtain station status, or both.
     *
     * @since 8.0
     */
    //const val ENQ: Byte = 5

    /**
     * Acknowledge: A communication control character transmitted by a receiver as an affirmative
     * response to a sender.
     *
     * @since 8.0
     */
    //const val ACK: Byte = 6

    /**
     * Bell ('\a'): A character for use when there is a need to call for human attention. It may
     * control alarm or attention devices.
     *
     * @since 8.0
     */
    const val BEL: UByte = 7u

    /**
     * Backspace ('\b'): A format effector which controls the movement of the printing position one
     * printing space backward on the same printing line. (Applicable also to display devices.)
     *
     * @since 8.0
     */
    //const val BS: Byte = 8

    /**
     * Horizontal Tabulation ('\t'): A format effector which controls the movement of the printing
     * position to the next in a series of predetermined positions along the printing line.
     * (Applicable also to display devices and the skip function on punched cards.)
     *
     * @since 8.0
     */
    const val HT: UByte = 9u

    /**
     * Line Feed ('\n'): A format effector which controls the movement of the printing position to the
     * next printing line. (Applicable also to display devices.) Where appropriate, this character may
     * have the meaning "New Line" (NL), a format effector which controls the movement of the printing
     * point to the first printing position on the next printing line. Use of this convention requires
     * agreement between sender and recipient of data.
     *
     * @since 8.0
     */
    //const val LF: Byte = 10

    /**
     * Alternate name for [.LF]. (`LF` is preferred.)
     *
     * @since 8.0
     */
    const val NL: UByte = 10u

    /**
     * Vertical Tabulation ('\v'): A format effector which controls the movement of the printing
     * position to the next in a series of predetermined printing lines. (Applicable also to display
     * devices.)
     *
     * @since 8.0
     */
    //const val VT: Byte = 11

    /**
     * Form Feed ('\f'): A format effector which controls the movement of the printing position to the
     * first pre-determined printing line on the next form or page. (Applicable also to display
     * devices.)
     *
     * @since 8.0
     */
    //const val FF: Byte = 12

    /**
     * Carriage Return ('\r'): A format effector which controls the movement of the printing position
     * to the first printing position on the same printing line. (Applicable also to display devices.)
     *
     * @since 8.0
     */
    //const val CR: Byte = 13

    /**
     * Shift Out: A control character indicating that the code combinations which follow shall be
     * interpreted as outside of the character set of the standard code table until a Shift In
     * character is reached.
     *
     * @since 8.0
     */
    //const val SO: Byte = 14

    /**
     * Shift In: A control character indicating that the code combinations which follow shall be
     * interpreted according to the standard code table.
     *
     * @since 8.0
     */
    //const val SI: Byte = 15

    /**
     * Data Link Escape: A communication control character which will change the meaning of a limited
     * number of contiguously following characters. It is used exclusively to provide supplementary
     * controls in data communication networks.
     *
     * @since 8.0
     */
    //const val DLE: Byte = 16

    /**
     * Device Control 1. Characters for the control of ancillary devices associated with data
     * processing or telecommunication systems, more especially switching devices "on" or "off." (If a
     * single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the
     * preferred assignment.)
     *
     * @since 8.0
     */
    //const val DC1: Byte = 17 // aka XON

    /**
     * Transmission On: Although originally defined as DC1, this ASCII control character is now better
     * known as the XON code used for software flow control in serial communications. The main use is
     * restarting the transmission after the communication has been stopped by the XOFF control code.
     *
     * @since 8.0
     */
    const val XON: UByte = 17u // aka DC1

    /**
     * Device Control 2. Characters for the control of ancillary devices associated with data
     * processing or telecommunication systems, more especially switching devices "on" or "off." (If a
     * single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the
     * preferred assignment.)
     *
     * @since 8.0
     */
    //const val DC2: Byte = 18

    /**
     * Device Control 3. Characters for the control of ancillary devices associated with data
     * processing or telecommunication systems, more especially switching devices "on" or "off." (If a
     * single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the
     * preferred assignment.)
     *
     * @since 8.0
     */
    //const val DC3: Byte = 19 // aka XOFF

    /**
     * Transmission off. See [.XON] for explanation.
     *
     * @since 8.0
     */
    const val XOFF: UByte = 19u // aka DC3

    /**
     * Device Control 4. Characters for the control of ancillary devices associated with data
     * processing or telecommunication systems, more especially switching devices "on" or "off." (If a
     * single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the
     * preferred assignment.)
     *
     * @since 8.0
     */
    //const val DC4: Byte = 20

    /**
     * Negative Acknowledge: A communication control character transmitted by a receiver as a negative
     * response to the sender.
     *
     * @since 8.0
     */
    //const val NAK: Byte = 21

    /**
     * Synchronous Idle: A communication control character used by a synchronous transmission system
     * in the absence of any other character to provide a signal from which synchronism may be
     * achieved or retained.
     *
     * @since 8.0
     */
    //const val SYN: Byte = 22

    /**
     * End of Transmission Block: A communication control character used to indicate the end of a
     * block of data for communication purposes. ETB is used for blocking data where the block
     * structure is not necessarily related to the processing format.
     *
     * @since 8.0
     */
    //const val ETB: Byte = 23

    /**
     * Cancel: A control character used to indicate that the data with which it is sent is in error or
     * is to be disregarded.
     *
     * @since 8.0
     */
    const val CAN: UByte = 24u

    /**
     * End of Medium: A control character associated with the sent data which may be used to identify
     * the physical end of the medium, or the end of the used, or wanted, portion of information
     * recorded on a medium. (The position of this character does not necessarily correspond to the
     * physical end of the medium.)
     *
     * @since 8.0
     */
    //const val EM: Byte = 25

    /**
     * Substitute: A character that may be substituted for a character which is determined to be
     * invalid or in error.
     *
     * @since 8.0
     */
    //const val SUB: Byte = 26

    /**
     * Escape: A control character intended to provide code extension (supplementary characters) in
     * general information interchange. The Escape character itself is a prefix affecting the
     * interpretation of a limited number of contiguously following characters.
     *
     * @since 8.0
     */
    //const val ESC: Byte = 27

    /**
     * File Separator: These four information separators may be used within data in optional fashion,
     * except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then
     * RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are
     * not specified.)
     *
     * @since 8.0
     */
    //const val FS: Byte = 28

    /**
     * Group Separator: These four information separators may be used within data in optional fashion,
     * except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then
     * RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are
     * not specified.)
     *
     * @since 8.0
     */
    //const val GS: Byte = 29

    /**
     * Record Separator: These four information separators may be used within data in optional
     * fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then
     * GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or
     * Unit are not specified.)
     *
     * @since 8.0
     */
    //const val RS: Byte = 30

    /**
     * Unit Separator: These four information separators may be used within data in optional fashion,
     * except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then
     * RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are
     * not specified.)
     *
     * @since 8.0
     */
    //const val US: Byte = 31

    /**
     * Space: A normally non-printing graphic character used to separate words. It is also a format
     * effector which controls the movement of the printing position, one printing position forward.
     * (Applicable also to display devices.)
     *
     * @since 8.0
     */
    const val SP: UByte = 32u

    /**
     * Alternate name for [.SP].
     *
     * @since 8.0
     */
    //const val SPACE: Byte = 32

    /**
     * Delete: This character is used primarily to "erase" or "obliterate" erroneous or unwanted
     * characters in perforated tape.
     *
     * @since 8.0
     */
    const val DEL: UByte = 127u



    /**
     * Returns a copy of the input string in which all [uppercase ASCII][.isUpperCase] have been converted to lowercase. All other characters are copied without
     * modification.
     */
    fun toLowerCase(string: String): String {
        val length = string.length
        var i = 0
        while (i < length) {
            if (isUpperCase(string[i])) {
                val chars = string.toCharArray()
                while (i < length) {
                    val c = chars[i]
                    if (isUpperCase(c)) {
                        chars[i] = (c.code xor CASE_MASK.code).toChar()
                    }
                    i++
                }
                return chars.concatToString()
            }
            i++
        }
        return string
    }

    /**
     * Returns a copy of the input character sequence in which all [ uppercase ASCII characters][.isUpperCase] have been converted to lowercase. All other characters are copied
     * without modification.
     *
     * @since 14.0
     */
    fun toLowerCase(chars: CharSequence): String {
        if (chars is String) {
            return toLowerCase(chars)
        }
        val newChars = CharArray(chars.length)
        for (i in newChars.indices) {
            newChars[i] = toLowerCase(chars[i])
        }
        return newChars.concatToString()
    }

    /**
     * If the argument is an [uppercase ASCII character][.isUpperCase], returns the
     * lowercase equivalent. Otherwise returns the argument.
     */
    fun toLowerCase(c: Char): Char {
        return if (isUpperCase(c)) (c.code xor CASE_MASK.code).toChar() else c
    }

    /**
     * Returns a copy of the input string in which all [lowercase ASCII][.isLowerCase] have been converted to uppercase. All other characters are copied without
     * modification.
     */
    fun toUpperCase(string: String): String {
        val length = string.length
        var i = 0
        while (i < length) {
            if (isLowerCase(string[i])) {
                val chars = string.toCharArray()
                while (i < length) {
                    val c = chars[i]
                    if (isLowerCase(c)) {
                        chars[i] = (c.code xor CASE_MASK.code).toChar()
                    }
                    i++
                }
                return chars.concatToString()
            }
            i++
        }
        return string
    }

    /**
     * Returns a copy of the input character sequence in which all [ lowercase ASCII characters][.isLowerCase] have been converted to uppercase. All other characters are copied
     * without modification.
     *
     * @since 14.0
     */
    fun toUpperCase(chars: CharSequence): String {
        if (chars is String) {
            return toUpperCase(chars)
        }
        val newChars = CharArray(chars.length)
        for (i in newChars.indices) {
            newChars[i] = toUpperCase(chars[i])
        }
        return newChars.concatToString()
    }

    /**
     * If the argument is a [lowercase ASCII character][.isLowerCase], returns the
     * uppercase equivalent. Otherwise returns the argument.
     */
    fun toUpperCase(c: Char): Char {
        return if (isLowerCase(c)) (c.code xor CASE_MASK.code).toChar() else c
    }

    /**
     * Indicates whether `c` is one of the twenty-six lowercase ASCII alphabetic characters
     * between `'a'` and `'z'` inclusive. All others (including non-ASCII characters)
     * return `false`.
     */
    fun isLowerCase(c: Char): Boolean {
        // Note: This was benchmarked against the alternate expression "(char)(c - 'a') < 26" (Nov '13)
        // and found to perform at least as well, or better.
        return c in 'a'..'z'
    }

    /**
     * Indicates whether `c` is one of the twenty-six uppercase ASCII alphabetic characters
     * between `'A'` and `'Z'` inclusive. All others (including non-ASCII characters)
     * return `false`.
     */
    fun isUpperCase(c: Char): Boolean {
        return c in 'A'..'Z'
    }

    /**
     * Truncates the given character sequence to the given maximum length. If the length of the
     * sequence is greater than `maxLength`, the returned string will be exactly `maxLength` chars in length and will end with the given `truncationIndicator`. Otherwise,
     * the sequence will be returned as a string with no changes to the content.
     *
     *
     * Examples:
     *
     * <pre>`Ascii.truncate("foobar", 7, "..."); // returns "foobar"
     * Ascii.truncate("foobar", 5, "..."); // returns "fo..."
    `</pre> *
     *
     *
     * **Note:** This method *may* work with certain non-ASCII text but is not safe for use
     * with arbitrary Unicode text. It is mostly intended for use with text that is known to be safe
     * for use with it (such as all-ASCII text) and for simple debugging text. When using this method,
     * consider the following:
     *
     *
     *  * it may split surrogate pairs
     *  * it may split characters and combining characters
     *  * it does not consider word boundaries
     *  * if truncating for display to users, there are other considerations that must be taken
     * into account
     *  * the appropriate truncation indicator may be locale-dependent
     *  * it is safe to use non-ASCII characters in the truncation indicator
     *
     *
     * @throws IllegalArgumentException if `maxLength` is less than the length of `truncationIndicator`
     * @since 16.0
     */
    fun truncate(seq: CharSequence, maxLength: Int, truncationIndicator: String): String {
        var seq = seq

        // length to truncate the sequence to, not including the truncation indicator
        val truncationLength = maxLength - truncationIndicator.length

        // in this worst case, this allows a maxLength equal to the length of the truncationIndicator,
        // meaning that a string will be truncated to just the truncation indicator itself
        checkArgument(
            truncationLength >= 0,
            "maxLength (%s) must be >= length of the truncation indicator (%s)",
            maxLength,
            truncationIndicator.length
        )
        if (seq.length <= maxLength) {
            val string = seq.toString()
            if (string.length <= maxLength) {
                return string
            }
            // if the length of the toString() result was > maxLength for some reason, truncate that
            seq = string
        }
        return StringBuilder(maxLength)
            .append(seq, 0, truncationLength)
            .append(truncationIndicator)
            .toString()
    }

    /**
     * Indicates whether the contents of the given character sequences `s1` and `s2` are
     * equal, ignoring the case of any ASCII alphabetic characters between `'a'` and `'z'`
     * or `'A'` and `'Z'` inclusive.
     *
     *
     * This method is significantly faster than [String.equalsIgnoreCase] and should be used
     * in preference if at least one of the parameters is known to contain only ASCII characters.
     *
     *
     * Note however that this method does not always behave identically to expressions such as:
     *
     *
     *  * `string.toUpperCase().equals("UPPER CASE ASCII")`
     *  * `string.toLowerCase().equals("lower case ascii")`
     *
     *
     *
     * due to case-folding of some non-ASCII characters (which does not occur in [ ][String.equalsIgnoreCase]). However in almost all cases that ASCII strings are used, the author
     * probably wanted the behavior provided by this method rather than the subtle and sometimes
     * surprising behavior of `toUpperCase()` and `toLowerCase()`.
     *
     * @since 16.0
     */
    fun equalsIgnoreCase(s1: CharSequence, s2: CharSequence): Boolean {
        // Calling length() is the null pointer check (so do it before we can exit early).
        val length = s1.length
        if (s1 === s2) {
            return true
        }
        if (length != s2.length) {
            return false
        }
        for (i in 0 until length) {
            val c1 = s1[i]
            val c2 = s2[i]
            if (c1 == c2) {
                continue
            }
            val alphaIndex = getAlphaIndex(c1)
            // This was also benchmarked using '&' to avoid branching (but always evaluate the rhs),
            // however this showed no obvious improvement.
            if (alphaIndex < 26 && alphaIndex == getAlphaIndex(c2)) {
                continue
            }
            return false
        }
        return true
    }

    /**
     * Returns the non-negative index value of the alpha character `c`, regardless of case. Ie,
     * 'a'/'A' returns 0 and 'z'/'Z' returns 25. Non-alpha characters return a value of 26 or greater.
     */
    private fun getAlphaIndex(c: Char): Int {
        // Fold upper-case ASCII to lower-case and make zero-indexed and unsigned (by casting to char).
        return ((c.code or CASE_MASK.code) - 'a'.code).toChar().code
    }



        /**
         * ASCII Null
         *
         * ```
         * '\u0000'
         * ```
         *
         * @see NIL
         * @see NULL
         */
        const val NUL: UByte = 0u

        /**
         * ASCII Null
         *
         * ```
         * '\u0000'
         * ```
         *
         * @see NUL
         * @see NULL
         *
         * @since 1.1.0
         */
        const val NIL: UByte = 0u

        /**
         * ASCII Null
         *
         * ```
         * '\u0000'
         * ```
         *
         * @see NUL
         * @see NIL
         *
         * @since 1.1.0
         */
        const val NULL: UByte = 0u

        /**
         * ASCII Start of Heading
         *
         * ```
         * '\u0001'
         * ```
         *
         * @see START_OF_HEADING
         */
        const val SOH: UByte = 1u

        /**
         * ASCII Start of Heading
         *
         * ```
         * '\u0001'
         * ```
         *
         * @see SOH
         *
         * @since 1.1.0
         */
        const val START_OF_HEADING: UByte = 1u

        /**
         * ASCII Start of Text
         *
         * ```
         * '\u0002'
         * ```
         *
         * @see START_OF_TEXT
         */
        const val STX: UByte = 2u

        /**
         * ASCII Start of Text
         *
         * ```
         * '\u0002'
         * ```
         *
         * @see STX
         *
         * @since 1.1.0
         */
        const val START_OF_TEXT: UByte = 2u

        /**
         * ASCII End of Text
         *
         * ```
         * '\u0003'
         * ```
         *
         * @see END_OF_TEXT
         */
        const val ETX: UByte = 3u

        /**
         * ASCII End of Text
         *
         * ```
         * '\u0003'
         * ```
         *
         * @see ETX
         *
         * @since 1.1.0
         */
        const val END_OF_TEXT: UByte = 3u

        /**
         * ASCII End of Transmission
         *
         * ```
         * '\u0004'
         * ```
         *
         * @see END_OF_TRANSMISSION
         *
         * @since 1.1.0
         */
        const val EOT: UByte = 4u

        /**
         * ASCII End of Transmission
         *
         * ```
         * '\u0004'
         * ```
         *
         * @see EOT
         */
        const val END_OF_TRANSMISSION: UByte = 4u

        /**
         * ASCII Enquiry
         *
         * ```
         * '\u0005'
         * ```
         *
         * @see ENQUIRY
         */
        const val ENQ: UByte = 5u

        /**
         * ASCII Enquiry
         *
         * ```
         * '\u0005'
         * ```
         *
         * @see ENQ
         *
         * @since 1.1.0
         */
        const val ENQUIRY: UByte = 5u

        /**
         * ASCII Acknowledge
         *
         * ```
         * '\u0006'
         * ```
         *
         * @see ACKNOWLEDGE
         */
        const val ACK: UByte = 6u

        /**
         * ASCII Acknowledge
         *
         * ```
         * '\u0006'
         * ```
         *
         * @see ACK
         *
         * @since 1.1.0
         */
        const val ACKNOWLEDGE: UByte = 6u

        /**
         * ASCII Bell Character
         *
         * ```
         * '\u0007'
         * ```
         */
        const val BELL: UByte = 7u

        /**
         * ASCII Backspace
         *
         * ```
         * '\u0008'
         * ```
         *
         * @see BACKSPACE
         */
        const val BS: UByte = 8u

        /**
         * ASCII Backspace
         *
         * ```
         * '\u0008'
         * ```
         *
         * @see BS
         *
         * @since 1.1.0
         */
        const val BACKSPACE: UByte = 8u

        /**
         * ASCII Horizontal Tab
         *
         * ```
         * '\t'
         * ```
         */
        const val TAB: UByte = 9u

        /**
         * ASCII Line Feed
         *
         * ```
         * '\n'
         * ```
         *
         * @see LINE_FEED
         */
        const val LF: UByte = 10u

        /**
         * ASCII Line Feed
         *
         * ```
         * '\n'
         * ```
         *
         * @see LF
         *
         * @since 1.1.0
         */
        const val LINE_FEED: UByte = 10u

        /**
         * ASCII Vertical Tab
         *
         * ```
         * '\u000B'
         * ```
         *
         * @see VERTICAL_TAB
         */
        const val VT: UByte = 11u

        /**
         * ASCII Vertical Tab
         *
         * ```
         * '\u000B'
         * ```
         *
         * @see VT
         *
         * @since 1.1.0
         */
        const val VERTICAL_TAB: UByte = 11u

        /**
         * ASCII Form Feed
         *
         * ```
         * '\u000C'
         * ```
         *
         * @see FORM_FEED
         */
        const val FF: UByte = 12u

        /**
         * ASCII Form Feed
         *
         * ```
         * '\u000C'
         * ```
         *
         * @see FF
         *
         * @since 1.1.0
         */
        const val FORM_FEED: UByte = 12u

        /**
         * ASCII Carriage Return
         *
         * ```
         * '\r'
         * ```
         *
         * @see CARRIAGE_RETURN
         */
        const val CR: UByte = 13u

        /**
         * ASCII Carriage Return
         *
         * ```
         * '\r'
         * ```
         *
         * @see CR
         *
         * @since 1.1.0
         */
        const val CARRIAGE_RETURN: UByte = 13u

        /**
         * ASCII Shift Out
         *
         * ```
         * '\u000E'
         * ```
         *
         * @see SHIFT_OUT
         */
        const val SO: UByte = 14u

        /**
         * ASCII Shift Out
         *
         * ```
         * '\u000E'
         * ```
         *
         * @see SO
         *
         * @since 1.1.0
         */
        const val SHIFT_OUT: UByte = 14u

        /**
         * ASCII Shift In
         *
         * ```
         * '\u000F'
         * ```
         *
         * @see SHIFT_IN
         */
        const val SI: UByte = 15u

        /**
         * ASCII Shift In
         *
         * ```
         * '\u000F'
         * ```
         *
         * @see SI
         *
         * @since 1.1.0
         */
        const val SHIFT_IN: UByte = 15u

        /**
         * ASCII Data Link Escape
         *
         * ```
         * '\u0010'
         * ```
         *
         * @see DATA_LINK_ESCAPE
         */
        const val DLE: UByte = 16u

        /**
         * ASCII Data Link Escape
         *
         * ```
         * '\u0010'
         * ```
         *
         * @see DLE
         *
         * @since 1.1.0
         */
        const val DATA_LINK_ESCAPE: UByte = 16u

        /**
         * ASCII Device Control 1
         *
         * ```
         * '\u0011'
         * ```
         *
         * @see DEVICE_CONTROL_1
         */
        const val DC1: UByte = 17u

        /**
         * ASCII Device Control 1
         *
         * ```
         * '\u0011'
         * ```
         *
         * @see DC1
         *
         * @since 1.1.0
         */
        const val DEVICE_CONTROL_1: UByte = 17u

        /**
         * ASCII Device Control 2
         *
         * ```
         * '\u0012'
         * ```
         *
         * @see DEVICE_CONTROL_2
         */
        const val DC2: UByte = 18u

        /**
         * ASCII Device Control 2
         *
         * ```
         * '\u0012'
         * ```
         *
         * @see DC2
         *
         * @since 1.1.0
         */
        const val DEVICE_CONTROL_2: UByte = 18u

        /**
         * ASCII Device Control 3
         *
         * ```
         * '\u0013'
         * ```
         *
         * @see DEVICE_CONTROL_3
         */
        const val DC3: UByte = 19u

        /**
         * ASCII Device Control 3
         *
         * ```
         * '\u0013'
         * ```
         *
         * @see DC3
         *
         * @since 1.1.0
         */
        const val DEVICE_CONTROL_3: UByte = 19u

        /**
         * ASCII Device Control 4
         *
         * ```
         * '\u0014'
         * ```
         *
         * @see DEVICE_CONTROL_4
         */
        const val DC4: UByte = 20u

        /**
         * ASCII Device Control 4
         *
         * ```
         * '\u0014'
         * ```
         *
         * @see DC4
         *
         * @since 1.1.0
         */
        const val DEVICE_CONTROL_4: UByte = 20u

        /**
         * ASCII Negative Acknowledge
         *
         * ```
         * '\u0015'
         * ```
         *
         * @see NEGATIVE_ACKNOWLEDGE
         */
        const val NAK: UByte = 21u

        /**
         * ASCII Negative Acknowledge
         *
         * ```
         * '\u0015'
         * ```
         *
         * @see NAK
         *
         * @since 1.1.0
         */
        const val NEGATIVE_ACKNOWLEDGE: UByte = 21u

        /**
         * ASCII Synchronize
         *
         * ```
         * '\u0016'
         * ```
         *
         * @see SYNCHRONOUS_IDLE
         */
        const val SYN: UByte = 22u

        /**
         * ASCII Synchronize
         *
         * ```
         * '\u0016'
         * ```
         *
         * @see SYN
         *
         * @since 1.1.0
         */
        const val SYNCHRONOUS_IDLE: UByte = 22u

        /**
         * ASCII End of Transmission Block
         *
         * ```
         * '\u0017'
         * ```
         *
         * @see END_OF_TRANSMISSION_BLOCK
         */
        const val ETB: UByte = 23u

        /**
         * ASCII End of Transmission Block
         *
         * ```
         * '\u0017'
         * ```
         *
         * @see ETB
         *
         * @since 1.1.0
         */
        const val END_OF_TRANSMISSION_BLOCK: UByte = 23u

        /**
         * ASCII Cancel
         *
         * ```
         * '\u0018'
         * ```
         */
        const val CANCEL: UByte = 24u

        /**
         * ASCII End of Medium
         *
         * ```
         * '\u0019'
         * ```
         *
         * @see END_OF_MEDIUM
         */
        const val EM: UByte = 25u

        /**
         * ASCII End of Medium
         *
         * ```
         * '\u0019'
         * ```
         *
         * @see EM
         *
         * @since 1.1.0
         */
        const val END_OF_MEDIUM: UByte = 25u

        /**
         * ASCII Substitute
         *
         * ```
         * '\u001A'
         * ```
         *
         * @see SUBSTITUTE
         */
        const val SUB: UByte = 26u

        /**
         * ASCII Substitute
         *
         * ```
         * '\u001A'
         * ```
         *
         * @see SUB
         *
         * @since 1.1.0
         */
        const val SUBSTITUTE: UByte = 26u

        /**
         * ASCII Escape
         *
         * ```
         * '\u001B'
         * ```
         *
         * @see ESCAPE
         */
        const val ESC: UByte = 27u

        /**
         * ASCII Escape
         *
         * ```
         * '\u001B'
         * ```
         *
         * @see ESC
         *
         * @since 1.1.0
         */
        const val ESCAPE: UByte = 27u

        /**
         * ASCII File Separator
         *
         * ```
         * '\u001C'
         * ```
         *
         * @see FILE_SEPARATOR
         */
        const val FS: UByte = 28u

        /**
         * ASCII File Separator
         *
         * ```
         * '\u001C'
         * ```
         *
         * @see FS
         *
         * @since 1.1.0
         */
        const val FILE_SEPARATOR: UByte = 28u

        /**
         * ASCII Group Separator
         *
         * ```
         * '\u001D'
         * ```
         *
         * @see GROUP_SEPARATOR
         */
        const val GS: UByte = 29u

        /**
         * ASCII Group Separator
         *
         * ```
         * '\u001D'
         * ```
         *
         * @see GS
         *
         * @since 1.1.0
         */
        const val GROUP_SEPARATOR: UByte = 29u

        /**
         * ASCII Record Separator
         *
         * ```
         * '\u001E'
         * ```
         *
         * @see RECORD_SEPARATOR
         */
        const val RS: UByte = 30u

        /**
         * ASCII Record Separator
         *
         * ```
         * '\u001E'
         * ```
         *
         * @see RS
         *
         * @since 1.1.0
         */
        const val RECORD_SEPARATOR: UByte = 30u

        /**
         * ASCII Unit Separator
         *
         * ```
         * '\u001F'
         * ```
         *
         * @see UNIT_SEPARATOR
         */
        const val US: UByte = 31u

        /**
         * ASCII Unit Separator
         *
         * ```
         * '\u001F'
         * ```
         *
         * @see US
         *
         * @since 1.1.0
         */
        const val UNIT_SEPARATOR: UByte = 31u

        /**
         * ASCII Space
         *
         * ```
         * ' '
         * ```
         */
        const val SPACE: UByte = 32u

        /**
         * ASCII Exclamation Mark
         *
         * ```
         * '!'
         * ```
         */
        const val EXCLAIM: UByte = 33u

        /**
         * ASCII Double Quote
         *
         * ```
         * '"'
         * ```
         */
        const val DOUBLE_QUOTE: UByte = 34u

        /**
         * ASCII Number Sign
         *
         * ```
         * '#'
         * ```
         *
         * @see HASH
         * @see POUND
         */
        const val NUMBER: UByte = 35u

        /**
         * ASCII Number Sign
         *
         * ```
         * '#'
         * ```
         *
         * @see NUMBER
         * @see POUND
         *
         * @since 1.1.0
         */
        const val HASH: UByte = 35u

        /**
         * ASCII Number Sign
         *
         * ```
         * '#'
         * ```
         *
         * @see NUMBER
         * @see HASH
         *
         * @since 1.1.0
         */
        const val POUND: UByte = 35u

        /**
         * ASCII Dollar Sign
         *
         * ```
         * '$'
         * ```
         */
        const val DOLLAR: UByte = 36u

        /**
         * ASCII Percent Sign
         *
         * ```
         * '%'
         * ```
         */
        const val PERCENT: UByte = 37u

        /**
         * ASCII Ampersand
         *
         * ```
         * '&'
         * ```
         *
         * @see AMPERSAND
         */
        const val AMP: UByte = 38u

        /**
         * ASCII Ampersand
         *
         * ```
         * '&'
         * ```
         *
         * @see AMP
         *
         * @since 1.1.0
         */
        const val AMPERSAND: UByte = 38u

        /**
         * ASCII Single Quote
         *
         * ```
         * '\''
         * ```
         *
         * @see APOSTROPHE
         * @see SINGLE_QUOTE
         */
        const val APOS: UByte = 39u

        /**
         * ASCII Single Quote
         *
         * ```
         * '\''
         * ```
         *
         * @see APOS
         * @see SINGLE_QUOTE
         *
         * @since 1.1.0
         */
        const val APOSTROPHE: UByte = 39u

        /**
         * ASCII Single Quote
         *
         * ```
         * '\''
         * ```
         *
         * @see APOS
         * @see APOSTROPHE
         *
         * @since 1.1.0
         */
        const val SINGLE_QUOTE: UByte = 39u

        /**
         * ASCII Left Parenthesis
         *
         * ```
         * '('
         * ```
         */
        const val PAREN_OPEN: UByte = 40u

        /**
         * ASCII Right Parenthesis
         *
         * ```
         * ')'
         * ```
         */
        const val PAREN_CLOSE: UByte = 41u

        /**
         * ASCII Asterisk
         *
         * ```
         * '*'
         * ```
         */
        const val ASTERISK: UByte = 42u

        /**
         * ASCII Plus Sign
         *
         * ```
         * '+'
         * ```
         */
        const val PLUS: UByte = 43u

        /**
         * ASCII Comma
         *
         * ```
         * ','
         * ```
         */
        const val COMMA: UByte = 44u

        /**
         * ASCII Minus Sign
         *
         * ```
         * '-'
         * ```
         *
         * @see DASH
         * @see HYPHEN
         */
        const val MINUS: UByte = 45u

        /**
         * ASCII Minus Sign
         *
         * ```
         * '-'
         * ```
         *
         * @see MINUS
         * @see HYPHEN
         *
         * @since 1.1.0
         */
        const val DASH: UByte = 45u

        /**
         * ASCII Minus Sign
         *
         * ```
         * '-'
         * ```
         *
         * @see MINUS
         * @see DASH
         *
         * @since 1.1.0
         */
        const val HYPHEN: UByte = 45u

        /**
         * ASCII Period
         *
         * ```
         * '.'
         * ```
         */
        const val PERIOD: UByte = 46u

        /**
         * ASCII Forward Slash
         *
         * ```
         * '/'
         * ```
         */
        const val SLASH: UByte = 47u

        /**
         * ASCII Digit 0
         *
         * ```
         * '0'
         * ```
         */
        const val DIGIT_0: UByte = 48u

        /**
         * ASCII Digit 1
         *
         * ```
         * '1'
         * ```
         */
        const val DIGIT_1: UByte = 49u

        /**
         * ASCII Digit 2
         *
         * ```
         * '2'
         * ```
         */
        const val DIGIT_2: UByte = 50u

        /**
         * ASCII Digit 3
         *
         * ```
         * '3'
         * ```
         */
        const val DIGIT_3: UByte = 51u

        /**
         * ASCII Digit 4
         *
         * ```
         * '4'
         * ```
         */
        const val DIGIT_4: UByte = 52u

        /**
         * ASCII Digit 5
         *
         * ```
         * '5'
         * ```
         */
        const val DIGIT_5: UByte = 53u

        /**
         * ASCII Digit 6
         *
         * ```
         * '6'
         * ```
         */
        const val DIGIT_6: UByte = 54u

        /**
         * ASCII Digit 7
         *
         * ```
         * '7'
         * ```
         */
        const val DIGIT_7: UByte = 55u

        /**
         * ASCII Digit 8
         *
         * ```
         * '8'
         * ```
         */
        const val DIGIT_8: UByte = 56u

        /**
         * ASCII Digit 9
         *
         * ```
         * '9'
         * ```
         */
        const val DIGIT_9: UByte = 57u

        /**
         * ASCII Colon
         *
         * ```
         * ':'
         * ```
         */
        const val COLON: UByte = 58u

        /**
         * ASCII Semicolon
         *
         * ```
         * ';'
         * ```
         */
        const val SEMICOLON: UByte = 59u

        /**
         * ASCII Less Than Sign
         *
         * ```
         * '<'
         * ```
         *
         * @see LESS_THAN
         */
        const val LESS: UByte = 60u

        /**
         * ASCII Less Than Sign
         *
         * ```
         * '<'
         * ```
         *
         * @see LESS
         *
         * @since 1.1.0
         */
        const val LESS_THAN: UByte = 60u

        /**
         * ASCII Equals Sign
         *
         * ```
         * '='
         * ```
         */
        const val EQUALS: UByte = 61u

        /**
         * ASCII Greater Than Sign
         *
         * ```
         * '>'
         * ```
         *
         * @see GREATER_THAN
         *
         * @since 1.1.0
         */
        const val GREATER: UByte = 62u

        /**
         * ASCII Greater Than Sign
         *
         * ```
         * '>'
         * ```
         *
         * @see GREATER
         */
        const val GREATER_THAN: UByte = 62u

        /**
         * ASCII Question Mark
         *
         * ```
         * '?'
         * ```
         */
        const val QUESTION: UByte = 63u

        /**
         * ASCII At/Address Sign
         *
         * ```
         * '@'
         * ```
         */
        const val AT: UByte = 64u

        /**
         * ASCII Uppercase Letter A
         *
         * ```
         * 'A'
         * ```
         */
        const val UPPER_A: UByte = 65u

        /**
         * ASCII Uppercase Letter B
         *
         * ```
         * 'B'
         * ```
         */
        const val UPPER_B: UByte = 66u

        /**
         * ASCII Uppercase Letter C
         *
         * ```
         * 'C'
         * ```
         */
        const val UPPER_C: UByte = 67u

        /**
         * ASCII Uppercase Letter D
         *
         * ```
         * 'D'
         * ```
         */
        const val UPPER_D: UByte = 68u

        /**
         * ASCII Uppercase Letter E
         *
         * ```
         * 'E'
         * ```
         */
        const val UPPER_E: UByte = 69u

        /**
         * ASCII Uppercase Letter F
         *
         * ```
         * 'F'
         * ```
         */
        const val UPPER_F: UByte = 70u

        /**
         * ASCII Uppercase Letter G
         *
         * ```
         * 'G'
         * ```
         */
        const val UPPER_G: UByte = 71u

        /**
         * ASCII Uppercase Letter H
         *
         * ```
         * 'H'
         * ```
         */
        const val UPPER_H: UByte = 72u

        /**
         * ASCII Uppercase Letter I
         *
         * ```
         * 'I'
         * ```
         */
        const val UPPER_I: UByte = 73u

        /**
         * ASCII Uppercase Letter J
         *
         * ```
         * 'J'
         * ```
         */
        const val UPPER_J: UByte = 74u

        /**
         * ASCII Uppercase Letter K
         *
         * ```
         * 'K'
         * ```
         */
        const val UPPER_K: UByte = 75u

        /**
         * ASCII Uppercase Letter L
         *
         * ```
         * 'L'
         * ```
         */
        const val UPPER_L: UByte = 76u

        /**
         * ASCII Uppercase Letter M
         *
         * ```
         * 'M'
         * ```
         */
        const val UPPER_M: UByte = 77u

        /**
         * ASCII Uppercase Letter N
         *
         * ```
         * 'N'
         * ```
         */
        const val UPPER_N: UByte = 78u

        /**
         * ASCII Uppercase Letter O
         *
         * ```
         * 'O'
         * ```
         */
        const val UPPER_O: UByte = 79u

        /**
         * ASCII Uppercase Letter P
         *
         * ```
         * 'P'
         * ```
         */
        const val UPPER_P: UByte = 80u

        /**
         * ASCII Uppercase Letter Q
         *
         * ```
         * 'Q'
         * ```
         */
        const val UPPER_Q: UByte = 81u

        /**
         * ASCII Uppercase Letter R
         *
         * ```
         * 'R'
         * ```
         */
        const val UPPER_R: UByte = 82u

        /**
         * ASCII Uppercase Letter S
         *
         * ```
         * 'S'
         * ```
         */
        const val UPPER_S: UByte = 83u

        /**
         * ASCII Uppercase Letter T
         *
         * ```
         * 'T'
         * ```
         */
        const val UPPER_T: UByte = 84u

        /**
         * ASCII Uppercase Letter U
         *
         * ```
         * 'U'
         * ```
         */
        const val UPPER_U: UByte = 85u

        /**
         * ASCII Uppercase Letter V
         *
         * ```
         * 'V'
         * ```
         */
        const val UPPER_V: UByte = 86u

        /**
         * ASCII Uppercase Letter W
         *
         * ```
         * 'W'
         * ```
         */
        const val UPPER_W: UByte = 87u

        /**
         * ASCII Uppercase Letter X
         *
         * ```
         * 'X'
         * ```
         */
        const val UPPER_X: UByte = 88u

        /**
         * ASCII Uppercase Letter Y
         *
         * ```
         * 'Y'
         * ```
         */
        const val UPPER_Y: UByte = 89u

        /**
         * ASCII Uppercase Letter Z
         *
         * ```
         * 'Z'
         * ```
         */
        const val UPPER_Z: UByte = 90u

        /**
         * ASCII Left Square Bracket
         *
         * ```
         * '['
         * ```
         */
        const val SQUARE_OPEN: UByte = 91u

        /**
         * ASCII Backslash
         *
         * ```
         * '\\'
         * ```
         */
        const val BACKSLASH: UByte = 92u

        /**
         * ASCII Right Square Bracket
         *
         * ```
         * ']'
         * ```
         */
        const val SQUARE_CLOSE: UByte = 93u

        /**
         * ASCII Caret / Circumflex
         *
         * ```
         * '^'
         * ```
         */
        const val CARET: UByte = 94u

        /**
         * ASCII Underscore
         *
         * ```
         * '_'
         * ```
         */
        const val UNDER: UByte = 95u

        /**
         * ASCII Grave Accent
         *
         * ```
         * '`'
         * ```
         */
        const val GRAVE: UByte = 96u

        /**
         * ASCII Lowercase Letter A
         *
         * ```
         * 'a'
         * ```
         */
        const val LOWER_A: UByte = 97u

        /**
         * ASCII Lowercase Letter B
         *
         * ```
         * 'b'
         * ```
         */
        const val LOWER_B: UByte = 98u

        /**
         * ASCII Lowercase Letter C
         *
         * ```
         * 'c'
         * ```
         */
        const val LOWER_C: UByte = 99u

        /**
         * ASCII Lowercase Letter D
         *
         * ```
         * 'd'
         * ```
         */
        const val LOWER_D: UByte = 100u

        /**
         * ASCII Lowercase Letter E
         *
         * ```
         * 'e'
         * ```
         */
        const val LOWER_E: UByte = 101u

        /**
         * ASCII Lowercase Letter F
         *
         * ```
         * 'f'
         * ```
         */
        const val LOWER_F: UByte = 102u

        /**
         * ASCII Lowercase Letter G
         *
         * ```
         * 'g'
         * ```
         */
        const val LOWER_G: UByte = 103u

        /**
         * ASCII Lowercase Letter H
         *
         * ```
         * 'h'
         * ```
         */
        const val LOWER_H: UByte = 104u

        /**
         * ASCII Lowercase Letter I
         *
         * ```
         * 'i'
         * ```
         */
        const val LOWER_I: UByte = 105u

        /**
         * ASCII Lowercase Letter J
         *
         * ```
         * 'j'
         * ```
         */
        const val LOWER_J: UByte = 106u

        /**
         * ASCII Lowercase Letter K
         *
         * ```
         * 'k'
         * ```
         */
        const val LOWER_K: UByte = 107u

        /**
         * ASCII Lowercase Letter L
         *
         * ```
         * 'l'
         * ```
         */
        const val LOWER_L: UByte = 108u

        /**
         * ASCII Lowercase Letter M
         *
         * ```
         * 'm'
         * ```
         */
        const val LOWER_M: UByte = 109u

        /**
         * ASCII Lowercase Letter N
         *
         * ```
         * 'n'
         * ```
         */
        const val LOWER_N: UByte = 110u

        /**
         * ASCII Lowercase Letter O
         *
         * ```
         * 'o'
         * ```
         */
        const val LOWER_O: UByte = 111u

        /**
         * ASCII Lowercase Letter P
         *
         * ```
         * 'p'
         * ```
         */
        const val LOWER_P: UByte = 112u

        /**
         * ASCII Lowercase Letter Q
         *
         * ```
         * 'q'
         * ```
         */
        const val LOWER_Q: UByte = 113u

        /**
         * ASCII Lowercase Letter R
         *
         * ```
         * 'r'
         * ```
         */
        const val LOWER_R: UByte = 114u

        /**
         * ASCII Lowercase Letter S
         *
         * ```
         * 's'
         * ```
         */
        const val LOWER_S: UByte = 115u

        /**
         * ASCII Lowercase Letter T
         *
         * ```
         * 't'
         * ```
         */
        const val LOWER_T: UByte = 116u

        /**
         * ASCII Lowercase Letter U
         *
         * ```
         * 'u'
         * ```
         */
        const val LOWER_U: UByte = 117u

        /**
         * ASCII Lowercase Letter V
         *
         * ```
         * 'v'
         * ```
         */
        const val LOWER_V: UByte = 118u

        /**
         * ASCII Lowercase Letter W
         *
         * ```
         * 'w'
         * ```
         */
        const val LOWER_W: UByte = 119u

        /**
         * ASCII Lowercase Letter X
         *
         * ```
         * 'x'
         * ```
         */
        const val LOWER_X: UByte = 120u

        /**
         * ASCII Lowercase Letter Y
         *
         * ```
         * 'y'
         * ```
         */
        const val LOWER_Y: UByte = 121u

        /**
         * ASCII Lowercase Letter Z
         *
         * ```
         * 'z'
         * ```
         */
        const val LOWER_Z: UByte = 122u

        /**
         * ASCII Left Curly Bracket
         *
         * ```
         * '{'
         * ```
         */
        const val CURLY_OPEN: UByte = 123u

        /**
         * ASCII Vertical Line
         *
         * ```
         * '|'
         * ```
         *
         * @see VERTICAL_LINE
         */
        const val PIPE: UByte = 124u

        /**
         * ASCII Vertical Line
         *
         * ```
         * '|'
         * ```
         *
         * @see PIPE
         *
         * @since 1.1.0
         */
        const val VERTICAL_LINE: UByte = 124u

        /**
         * ASCII Right Curly Bracket
         *
         * ```
         * '}'
         * ```
         */
        const val CURLY_CLOSE: UByte = 125u

        /**
         * ASCII Tilde
         *
         * ```
         * '~'
         * ```
         */
        const val TILDE: UByte = 126u

        /**
         * ASCII Delete
         *
         * ```
         * '\u007F'
         * ```
         */
        const val DELETE: UByte = 127u

}